<?php

declare(strict_types=1);

namespace app\admin\validate;

use think\Validate;

class MinescreenFirmwareVersion extends Validate
{

    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'firmware_download_addr' => 'require|url',
        'pageIndex' => 'number|gt:0',
        'pageSize' =>  'number|gt:0',
    ];

    protected $scene = [
        'index' => ['pageIndex', 'pageSize'],
        'save' => ['firmware_download_addr']
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'pageIndex.number'          => 'page格式错误',
        'pageIndex.gt'          => 'page格式错误',
        'pageSize.number'          => 'limit格式错误',
        'pageSize.gt'          => 'limit格式错误',
        'firmware_download_addr.require'          => '固件地址不能为空',
        'firmware_download_addr.url'              => '固件地址格式错误',
    ];
}
